/**
 * @Author: Sagan
 * @Date: 2020/09/16 21:15
 */
package module

import (
	"gitee.com/big_meteor/godash/lang"
	"reflect"
	"strconv"
)

// 是否为浮点数
// 支持的类型：float
func Float(v interface{}) bool {
	kind := lang.GetType(v)

	if reflect.Float32 == kind || reflect.Float64 == kind {
		return true
	}

	v, kind = lang.GetValue(v)

	if reflect.String == kind {
		_, err := strconv.ParseFloat(v.(string), 64)
		return nil == err
	}

	return false
}
